package zct.proj.equipModel;

import android.graphics.Point;

public abstract class BaseModel {

	// 缩放比例
	protected float scale;
	// x单位宽（原始）
	protected int orgXSp;
	// y单位高（原始）
	protected int orgYSp;
	// x单位宽
	protected int xSpacing;
	// y单位高
	protected int ySpacing;
	
	public void setScale(float scale) {
		this.scale = scale;
		this.init();
	}
	
	public BaseModel(float scale, int cellWidth, int cellHeight) {
		this.scale = scale;
		this.orgXSp = cellWidth;
		this.orgYSp = cellHeight;
		this.init();
	}
	
	protected void init() {
		xSpacing = (int) (scale * orgXSp);
		ySpacing = (int) (scale * orgYSp);
	}
	
	protected Point offset(Point src, Point ofs) {
		return new Point(src.x + ofs.x, src.y + ofs.y);
	}
	
	protected Point offset(Point src, int x, int y) {
//		Log.v("drawLine", src.x + "," + src.y + " - " + x + "," + y);
		return new Point(src.x + x, src.y + y);
	}
}
